package dao;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import vo.CartVO;

public class CartDAO {

	private SqlMapClientTemplate client;
	private CartVO overlapVO;
	private ArrayList<CartVO> cart;
	
	public void setSqlMapClientTemplate(SqlMapClientTemplate client) {
		this.client = client;
	}
	
	public void insertCart(CartVO cvo) throws SQLException{
		client.insert("insertCart", cvo);
	}
	
	public CartVO selectOverlapCart(HashMap<String, String> key) throws SQLException{
		return overlapVO = (CartVO) client.queryForObject("selectOverlapCart", key);
	}
	
	public void updateCart(CartVO cvo) throws SQLException{
		client.update("updateCart", cvo);
	}
	
	public ArrayList<CartVO> selectAllCart(String cartId) throws SQLException{
		return cart = (ArrayList<CartVO>) client.queryForList("selectAllCart", cartId);
	}
}
